﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace GroupMappedDiskSnapInExtension
{
    public partial class MappingEditor : Form
    {
        public MappingEditor()
        {
            InitializeComponent();
        }

        private void browseForPath_Click(object sender, EventArgs e)
        {
            var dialog = new FolderBrowserDialog();
            dialog.SelectedPath = destPath.Text;
            if(dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                destPath.Text = dialog.SelectedPath;
            }
        }
        
        public static bool Edit(ref string letter, ref string path)
        {
            var form = new MappingEditor();
            form.letter.Text = letter;
            form.destPath.Text = path;
            if(form.ShowDialog()==DialogResult.OK)
            {
                letter = form.letter.Text;
                path = form.destPath.Text;
                return true;
            }
            else
            {
                return false;
            }
        }

        private void okButton_Click(object sender, EventArgs e)
        {
            DialogResult = System.Windows.Forms.DialogResult.OK;
            Close();
        }

        private void cancelButton_Click(object sender, EventArgs e)
        {
            DialogResult = System.Windows.Forms.DialogResult.Cancel;
            Close();
        }
    }
}
